cmake_minimum_required(VERSION 3.1.3)

#获取程序名称--目录名称
get_filename_component(TragetName ${CMAKE_CURRENT_SOURCE_DIR} NAME)

#设置目标名称
project(${TragetName} LANGUAGES CXX)

#查找源码文件
file(GLOB_RECURSE MAIN_SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)

# -L
set(PROJECT_LIB_DIRECTORYS  
    ${EXTERNAL_LIBRARIES}
)

# -l
# set(LIBS json FwLog process_manage FwSqlite FWBus_cbb mosquitto FWMqtt_cbb CommonApi FWsyslog_cbb)
# set(LIBS FWBus_cbb mosquitto FWMqtt_cbb  FWsyslog_cbb)
set(LIBS pthread rockchip_mpp rockchip_vpu utils)

#-I
set(PROJECT_INCLUDES 
        ${PROJECT_INCLUDE_DIRS}
        ${CMAKE_CURRENT_SOURCE_DIR}
        ${CMAKE_CURRENT_SOURCE_DIR}/inc
)
#编译lib
ZHD_ADD_LIBRARY(TARGET ${PROJECT_NAME} SRCS ${MAIN_SOURCE_FILE}
        LIBDIR          ${PROJECT_LIB_DIRECTORYS}
        LIBS            ${LIBS}
        INCLUDES        ${PROJECT_INCLUDES}
        DESTINATION     lib 
)

#编译demo
file(GLOB_RECURSE DEMO_MAIN_SOURCE_FILE CONFIGURE_DEPENDS
  ${CMAKE_CURRENT_SOURCE_DIR}/demo/*.cpp
  ${MAIN_SOURCE_FILE}
)

ZHD_ADD_EXECUTABLE(
  TARGET cbb_camera_demo
  SRCS  ${DEMO_MAIN_SOURCE_FILE}
  LIBDIR ${EXTERNAL_LIBRARIES}
  LIBS ${LIBS}
  INCLUDES ${PROJECT_INCLUDES}
  DESTINATION bin
)
